home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Garbo
/
Garbo.cdr
/
mac
/
hypercrd
/
hc2_x
/
tcprogud.sit
/
TC Prog Guide
/
card_58064.txt
< prev
next >
Wrap
Text File
|
1991-02-27
|
900b
|
28 lines
-- card: 58064 from stack: in
-- bmap block id: 0
-- flags: 0000
-- background id: 4755
-- name:
-- part contents for background part 4
----- text -----
The fclose() function should be used to close the stream and its associated file after use. For example, to write text to the file 'output.fil':
# include <stdio.h>
.
.
FILE *fp; /* declare pointer to a FILE type */
fp = fopen("output.fil","w"); /* creates new file if non-existant */
if (fp != NULL)
{ fprintf(fp,"Here's some output: %d\n",99);
fclose(fp);
}
Note that fopen() returns the NULL pointer (defined in stdio.h) if it is unable to open the stream.
There are many other useful standard I/O functions available for binary I/O, non-sequential access, etc.
-- part contents for background part 7
----- text -----
192